/*
 * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
 *
 * https://www.mall4j.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */
package com.yami.shop.listener;

import com.yami.shop.bean.event.RefundInfoEvent;
import com.yami.shop.bean.model.RefundInfo;
import com.yami.shop.service.OrderRefundService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;


/**
 * 退款事件
 * @author yami
 */
@Slf4j
@Component("RefundInfoListener")
@AllArgsConstructor
public class RefundInfoListener {

    private final OrderRefundService orderRefundService;


    @EventListener(RefundInfoEvent.class)
    public void cancelOrderQrCode(RefundInfoEvent event) {
        RefundInfo refundInfo = event.getRefundInfo();
        orderRefundService.verifyRefund(refundInfo, refundInfo.getPayRefundId());
    }
}
